package org.wlw.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wlw.web.models.User;
import org.wlw.web.service.IUserService;

import java.util.List;

//只要加了RestController，意味着所有的相应都是json
@RestController
@RequestMapping("/json")
public class UserJsonController {
    @Autowired
    private IUserService userService;

    @GetMapping("/hello")
    public String hello() {
        return "hello";
    }

    @GetMapping("/users")
    public List<User> users() {
        return userService.list(null);
    }
}
